package com.obas.monitor;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class PolicyServer extends Thread {
   public static void main(String[] args) {
      new PolicyServer().run();
   }
   
   public void run() {
      boolean lising = true;
      ServerSocket ss = null;
      System.out.println("Policy server is listening at 843");
      try {
         ss = new ServerSocket(843);
         while (lising) {
            try {
               // 得到socket服务器
               Socket sc = ss.accept();
               SendPolicyFile sp = new SendPolicyFile(sc);
               new Thread(sp).start();
            } catch (IOException e) {
               e.printStackTrace();
            }

            try {
               Thread.sleep(1000);
            } catch (InterruptedException e) {
               e.printStackTrace();
            }

         }
         ss.close();
      } catch (Exception e1) {
         e1.printStackTrace();
      }

   }

}
